Posts

CShell: A Tactical Logic Engine in R

Image
VaShay Carpenter 1. THE CONCEPT The final project for this semester resulted in the development of CShell ;  a modular R package designed for tactical weather telemetry and logistical wardrobe planning. The package bridges the gap between raw weather data and human-centric decision-making. 2. INTEGRATING DISCRETE LOGIC While the package handles R code, its brain is built on Boolean Logic Gates . By mapping NWS weather telemetry to series (AND) and parallel (OR) circuits, CShell determines the optimal gear for any given environment. This demonstrates how data analysis can be leveraged to control the logical flow of information. Did those first-day jitters make you forget your Rain Shell ? By mapping weather telemetry to series (AND) and parallel (OR) circuits, CShell ensures your thermal regulation is never compromised by odd-degree human error. 2. HOW TO USE After successfully installing the CShell package, you may generate your outfit by typing any US city into the city_outfit() f...

Assignment 12: R Markdown

Image
  VaShay Carpenter Blog Post: Write a short reflection on your blog about: What you learned about Markdown syntax and LaTeX math. How code chunks and narrative sections integrate. Any challenges you faced in authoring or knitting. This assignment highlighted the efficiency of Markdown for structural formatting. Unlike traditional word processors, Markdown allows for rapid document drafting using simple text cues like # for headers and ** for emphasis. Integrating LaTeX was a standout feature; using delimiters  t o render complex math. The core strength of R Markdown is the seamless integration of executable code chunks with narrative text. This approach means the data analysis (loading datasets, calculating summary statistics, and generating boxplots) happens within the document itself. The primary challenge encountered during the authoring process was ensuring the document was entirely self-contained and minor syntax errors for adding links (being sure to include http://)....

Assignment #11: Debugging and Defensive Programming in R

Image
  VaShay Carpenter Objectives Learn to reproduce and interpret error messages in R. Practice identifying and fixing logical versus element-wise operations. Document a defensive programming workflow. Background &  Buggy  Code Below is a function intended to flag rows of a numeric matrix  x  that are outliers in  every  column according to the Tukey rule. The function contains a deliberate bug. A helper function for detecting Tukey outliers is provided first so that you can focus on debugging the logical error in the main function. tukey.outlier <- function(x, k = 1.5) { q1 <- quantile(x, 0.25, na.rm = TRUE) q3 <- quantile(x, 0.75, na.rm = TRUE) iqr <- q3 - q1 x < (q1 - k * iqr) | x > (q3 + k * iqr) } tukey_multiple <- function(x) { outliers <- array(TRUE, dim = dim(x)) for (j in 1:ncol(x)) { outliers[, j] <- outliers[, j] && tukey.outlier(x[, j]) } outlier.vec <- vector("logical", length = n...

Assignment #10: Building Your Own R Package

Project CShel: Biological Optimization through Wardrobe VaShay Carpenter Purpose: A predictive engine for travelers to prevent metabolic inefficiency and heat/cold stress. It translates raw weather data into specific layering and fabric requirements (e.g., Merino base vs. Synthetic shell) to maintain peak cognitive functioning. Key Functions: layer_logic() : Recommends specific fabric combinations based on dew point and wind chill. metabolic_floor() : Calculates the "Danger Zone" for current attire vs. forecasted drops. DESCRIPTION Logic: Imports: ggplot2 (visualizing thermal bands), dplyr (data filtering). Version: 0.0.0.9000 (Dev). License: CC0 (No friction for travelers). Repo Link:  https://github.com/cryo-cell/r-programming-assignments/tree/main/CShell "Modern fashion uses branding as a proxy for status, but the CShell package reclaims the original biological intent of the exterior. By applying social Darwinist methodologies to smart-clothing data, we categ...

Assignment #9: Visualization in R – Base Graphics, Lattice, and ggplot2

Image
 VaShay Carpenter Objectives Compare three visualization systems in R: base graphics, lattice, and ggplot2. Apply each system to the same dataset and observe similarities and differences. Develop clear, reproducible code and articulate your insights. Dataset Choose one dataset from the  Rdatasets collection Links to an external site. . Load it in R with: data("DatasetName", package = "PackageName") head(DatasetName) Tasks Base R Graphics Create at least two plots using base R functions. Examples: # Scatter plot plot(DatasetName$x, DatasetName$y, main = "Base: x vs. y", xlab = "x", ylab = "y") # Histogram hist(DatasetName$z, main = "Base: Distribution of z", xlab = "z") Lattice Graphics Use the lattice package to produce conditioned or multivariate plots. Examples: library(lattice) # Conditional scatter plot (small multiples) xyplot(y ~ x | factor(group), data = DatasetName,...

Module # 8 Input/Output, string manipulation and plyr package

Image
VaShay Carpenter   Please following steps 1-3 Step # 1   Import assignment 6 Data-set to R   Download Import assignment 6 Data-set to R . Then, Run the commend "mean" using Sex as the category (use plyr package for this operation). Last commend in this step:  write the resulting output to a file. >  <- read.table("<FileName>.txt", header = TRUE) >install.packages("pryr") require(pryr) require(ISLR) require(boot) install.packages("plyr") library(data.table) library(plyr) etc #----Read file from computer via prompt Student-assignment-6 < - read.table("<FileName>.txt", header = TRUE) Student-assignment-6 StudentAverage = ddply(Student,"Sex",transform,Grade.Average=mean(Grade)) sex = Student$Sex mean(Sex) Original Dataset Student Averages Step # 2  Convert the data set  to a  dataframe for names whos' name contains the letter i, then create a new data set with those names, Write those names to a file se...

Module # 7 R Object: S3 vs. S4 assignment

Image
Module # 7 assignment VaShay Carpenter Download any type of data (from the web or use datasets package) or create your own set.  Then, on the second step, determine if generic function as discussed in this module can be assigned to your data set, and if not, why? (Example, here is list of data set in R) data("mtcars") head (mtcars, 6) list(mtcars, 6) In third and last step, explore if S3 and S4 can be assigned to your data set.   In your blog, discuss the following questions: How do you tell what OO system (S3 vs. S4) an object is associated with? Using  isS4(obj) . If  TRUE , It is S4. If  is.object(obj)  is  TRUE but  isS4 is  FALSE , it is S3. How do you determine the base type (like integer or list) of an object? You can determine the base type of an object in R using  typeof(x)  or  class(x) For detailed structure, including types of columns, use str(x). The is.type() family (e.g.is.integer()) checks for specific types. ...